package ar.com.angrymachine.hunter;

import java.awt.Rectangle;
import ar.com.angrymachine.gameui.GameApp;
import ar.com.angrymachine.gameui.MessageBox;
import ar.com.angrymachine.gameui.Theme;
import ar.com.angrymachine.gameui.MessageBox.MessageBoxListener;
import ar.com.angrymachine.hunter.ui.MainWidget;

public class HunterApp extends GameApp implements MessageBoxListener
{
	private static final long serialVersionUID = 1L;
	public static HunterApp app;
    private MainWidget mainWidget;

    public static void main(String[] args)
    {
    	app = new HunterApp();
    	app.show(new Theme(), "Hunter RPG", "res/graphics/sword.png", 650, 630, GameSettings.TIMER_RATE);
    }
    
    public void resetGame()
    {
        new Game();
        mainWidget = new MainWidget(new Rectangle(0,0,gameCanvas.getWidth(), gameCanvas.getHeight()));
        gameCanvas.clear();
        gameCanvas.showWidget(mainWidget);
    }
    
    public void run()
    {
    }
    
    public void onGameOver()
    {
		// show message
		MessageBox mb = new MessageBox(mainWidget, this, "You lost!", "Restart");
		gameCanvas.showWidgetModal(mb);    	
    }

	public void onExit()
	{
	}

	public void onInit()
	{
    	// load resources
        HunterResourceManager.loadResources();
		resetGame();
	}

	public void onMessageBoxClosed(String buttonLabel)
	{
		resetGame();
	}
}
